<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <% if(user){ %>
      <nav>
        <h3><%=user.loginname%></h3>
        <a href="/users/logout">logout!</a>
      </nav>
    <% } else{ %>
      <h2>注册</h2>
      <form class="" action="/users/register" method="post">
        <input type="text" name="loginname" placeholder="用户名" value=""><br>
        <input type="password" name="password" placeholder="密码" value=""><br>
        <input type="password" name="confirm" placeholder="确认密码" value=""><br>
        <img src="/users/vimg" alt=""><input type="text" name="vimg" placeholder="验证码" value=""><br>
        <input type="submit" name="" value="注册">
      </form>
      <h2>登陆</h2>
      <form class="" action="/users/login" method="post">
        <input type="text" name="loginname" placeholder="用户名" value=""><br>
        <input type="password" name="password" placeholder="密码" value=""><br>
        <%=firstnum%>+<%=secondnum%>=<input type="text" name="vnum" value=""><br>
        <input type="submit" name="" value="登陆">
      </form>
    <% } %>
    <% if(message.length>0){ %>
      <ul>
        <% for(msg of message){ %>
          <li><%=msg.username.loginname%></li>
          <p><%=msg.text%></p>
          <% } %>
      </ul>
    <% } %>
    <% if(user){ %>
      <form class="" action="users/sendmsg" method="post">
        <textarea name="message" rows="8" cols="80"></textarea>
        <input type="submit" name="" value="留言">
      </form>
    <% } else{ %>
      <h3>若要留言请先登陆!!</h3>
    <% } %>

  </body>
</html>
